﻿@model Maticsoft.Model.tb_client
@{
    ViewBag.Title = "添加tb_client";
    Layout = "~/Views/Shared/_LayoutPage.cshtml";
}

<div class="main_content">
    <div class="top">
        <h3 class="fl">@ViewBag.Title</h3>
        <a class="fr back" href="javascript:history.go(-1)">返回</a>
    </div>
    <div class="main mt10 pt10">
        <div class="fl edit2">
            @using (Html.BeginForm())
            {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary(true)
                <ul>
      	                    <li class="fm_item">
                        @Html.LabelFor(model => model.id)：
                        @Html.TextBoxFor(model => model.id, new { @maxlength = 4 })
                        @Html.ValidationMessageFor(model => model.id)
                    </li>
		                    <li class="fm_item">
                        @Html.LabelFor(model => model.serverid)：
                        @Html.TextBoxFor(model => model.serverid, new { @maxlength = 4 })
                        @Html.ValidationMessageFor(model => model.serverid)
                    </li>
		                    <li class="fm_item">
                        @Html.LabelFor(model => model.sessionid)：
                        @Html.TextBoxFor(model => model.sessionid, new { @maxlength = 8 })
                        @Html.ValidationMessageFor(model => model.sessionid)
                    </li>
		                    <li class="fm_item">
                        @Html.LabelFor(model => model.projectname)：
                        @Html.TextBoxFor(model => model.projectname, new { @maxlength = 200 })
                        @Html.ValidationMessageFor(model => model.projectname)
                    </li>
		                    <li class="fm_item">
                        @Html.LabelFor(model => model.ip)：
                        @Html.TextBoxFor(model => model.ip, new { @maxlength = 100 })
                        @Html.ValidationMessageFor(model => model.ip)
                    </li>
		                    <li class="fm_item">
                        @Html.LabelFor(model => model.clientheartbeattime)：
                        @Html.TextBoxFor(model => model.clientheartbeattime, new { @maxlength = 8 })
                        @Html.ValidationMessageFor(model => model.clientheartbeattime)
                    </li>
		                    <li class="fm_item">
                        @Html.LabelFor(model => model.createtime)：
                        @Html.TextBoxFor(model => model.createtime, new { @maxlength = 8 })
                        @Html.ValidationMessageFor(model => model.createtime)
                    </li>
		  
                    <li class="fm_item" style="margin-top: 10px;">
                        <p class="box">
                            <input id="btnSave" type="button" class="btn" value="保存" />
                        </p>
                    </li>
                </ul>
            }
        </div>
    </div>
</div>
@section Scripts{
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    <script>
        $(function () {
            $("#btnSave").click(function () {
                if ($("form").valid()) {
                    var data = $("form").serialize();
                    $.ajax({
                        url: "/XX/XX/XXCreate",
                        type: "post",
                        data: data,
                        dataType: "json",
                        success: function (data) {
                            if (data.Flag) {
                                alert(data.Message);
                                window.location = "/XX/XX/XX
                                Index";
                            } else {
                                alert(data.Message);
                            }
                        }
                    });
                }
            });
        });
    </script>
}